package com.zt.controller;

import com.zt.service.AccountOpeningService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.date.DateTime;
import com.zt.service.AccountOpeningService;
import com.zt.system.AccountOpening;
import com.zt.utils.Result;
import com.zt.vo.Vo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import javax.annotation.Resource;

@RestController
@RequestMapping("accountOpening")
public class AccountOpeningController {

    @Resource
    private AccountOpeningService accountOpeningService;
    @PostMapping("saveAccount")
    public Result saveAccount(@RequestBody AccountOpening accountOpening) {
        accountOpening.setBindingId(1);
        accountOpening.setOpeningDate(new DateTime());
        return accountOpeningService.saveAccount(accountOpening);
    }
    //设置密码
    @PostMapping("savepass")
    public Result savepass(@RequestParam("openingId") Integer openingId,@RequestParam("bankNumber")String bankNumber) {
        Result savepassword=accountOpeningService.savepassword(openingId,bankNumber);
        return Result.success(savepassword);
    }
    //查询卡的密码
    @GetMapping("getbankNumber")
    public Result getbankNumber( String bankNumber){
        System.err.println("密码 = " + bankNumber);
        return accountOpeningService.getCardNumber(bankNumber);
    }
}
